<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        .d {
            border: 1px solid red;
            height: 100px;
            width: 300px;
        }
    </style>
</head>
<body>
<a href="http://www.baidu.com"></a>
<div id="div" class="d"> 这是一个点击事件</div>
<img src="img/timg1.jpg" id="img1">
<input type="button" onclick="f()" id="btn" value="点击">
<input type="button" id="btn1" value="点击切换图片">
<script type="text/javascript">
    document.getElementById("btn").onclick = function () {
        var a = document.getElementById("div").innerHTML;
        console.log(a);
    };
    document.getElementById("div").onmouseover = function () {
        document.getElementById("div").style = "background-color: pink ;"
    };
    document.getElementById("div").onmouseout = function () {
        document.getElementById("div").style = "background-color: aquamarine ;"
    };
    var i = 1;
    var c = document.getElementById("img1");
    document.getElementById("btn1").onclick = function () {
        if (i > 1) {
            i = 0
        }
        i++;
        c.src = "img/timg" + i + ".jpg"
    }
</script>
</body>
</html>